--[[
local CardsValue = {
    3,3,3,3,
    4,4,4,4,
    5,5,5,5,
    6,6,6,6,
    7,7,7,7,
    8,8,8,8,
    9,9,9,9,
    10,10,10,10,
    11,11,11,11,    -- J
    12,12,12,12,    -- Q
    13,13,13,13,    -- K
    14,14,14,14,    -- A
	15,15,15,15,	-- 2
	16,17        	-- joker
}
--]]

local config = {
	istest = false,
	use = 1,	-- 使用下面哪一个配置
	cards = {	-- 配置的值对应上面CardsValue的内容
		[1] = {
			value = {	-- 牌型
			   10, 10, 10, 10,  9,  9,  9,  9,  5,  5,  5,  5,  6,  6,  6,  6, 17,	-- 座位1将获得的手牌
			   14, 14, 14, 14,  7,  7,  7,  7,  8,  8,  8,  8,  4,  4,  4,  4, 16,	-- 座位2将获得的手牌
				3,  3,  3,  3, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 15,	-- 座位3将获得的手牌
			   15, 15, 15	-- 底牌
			},
		},
	},
}

config.value_map = {
	3,  3,  3,  3,  4,  4,  4,  4,  5,  5,  5,  5,  6,  6,  6,  6,
	7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9, 10, 10, 10, 10, 
   11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14,
   15, 15, 15, 15, 16, 17
}

local function check_config()
	if not config.istest then return end
	local conf = config.cards[config.use]
	if #conf.value ~= 54 then
		print("config error: cards total number is illegal!")
		return
	end
	local temp = {}
	for k, v in ipairs(conf.value) do
		if v < 1 or v > 17 then
			print("config error: value out of range!")
			return
		end
		if temp[v] then
			temp[v] = temp[v] + 1
		else
			temp[v] = 1
		end
	end
	for k, v in pairs(temp) do
		if k <= 15 then
			if v ~= 4 then
				print("config error: cards number is not 4!")
				return
			end
		elseif k == 16 then
			if v ~= 1 then
				print("config error: cards number is not 1!")
				return
			end
		elseif k == 17 then
			if v ~= 1 then
				print("config error: cards number is not 1!")
				return
			end
		end
	end
	print("config check succeed!")
end

check_config()

return config
